#include <QtCore/QCoreApplication>

#include "mydir.h"
#include "mystring.h"

#include <iostream>
using namespace std;


#include <stdio.h>
#include <dirent.h>

#define EXAMPLE 1
#define MYSTRING 0

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

#if EXAMPLE

    //    DIR *dp = opendir("D:");
    //    struct dirent *d;

    //    while (d = readdir(dp))
    //    {
    //        printf("%s\n", d->d_name);
    //    }

    //    closedir(dp);

    MyDir dir("D:");
    if (dir.isValid())
    {
        struct dirent d;
        while (dir.read(d))
        {
            printf("%s\n", d.d_name);
        }
    }

#elif MYSTRING
    MyString myname = "liuchengzhang";

    //strcpy(myname, "xxx");

    //cout << myname << endl;

    //char cstr[myname.length()+1];
    //myname.make_cstring(cstr, myname.length());
    //cout << cstr << endl;

    //myname += "-is NB";
    //cout << myname << endl;

    //MyString suff = "xxxx";
    //char *testLink = "testLink";
    //const char *ccc = "cccc";
    //cout << myname + " suff " + testLink + "ccc" << endl;
    
    MyString liucz = "liuchengzhang";
    if (myname == liucz)
        cout << myname << "==" << liucz << endl;
    else
        cout << myname << "!=" << liucz << endl;
#endif

    return a.exec();
}
